﻿
using System;
using System.Collections.Generic;

namespace MX.Core.Caching.Redis.Sider
{
	// see the redis commands reference for more info:
	// http://redis.io/commands
	public interface IRedisClient
	{
		Mode Mode { get; }
		 

		byte[] Custom (string command,
		               Action<ProtocolWriter> writerAction,
		               Func<ProtocolReader, byte[]> readAction);

		IEnumerable<T> Pipeline<T> (Action<IRedisClient > pipelinedCalls);


		// NOTE: Please see the RedisClient.API.cs file for a proper sorted listing
		//   that matches with commands on redis.io site as this file is
		//   extracted via a refactoring tool
		int Append (string key, byte[] value);

		bool Auth (string password);

		bool BgRewriteAof ();

		bool BgSave ();

		System.Collections.Generic.KeyValuePair<string, byte[]>? BLPop (int timeout, params string[] keys);

		System.Collections.Generic.KeyValuePair<string, byte[]>? BLPop (string[] keys, int timeout);

		System.Collections.Generic.KeyValuePair<string, byte[]>? BRPop (int timeout, params string[] keys);

		System.Collections.Generic.KeyValuePair<string, byte[]>? BRPop (string[] keys, int timeout);

		byte[] BRPopLPush (string src, string dest, int timeout);

		System.Collections.Generic.KeyValuePair<string, string>[] ConfigGet (string param);

		bool ConfigResetStat ();

		bool ConfigSet (string param, string value);

		int DbSize ();

		string DebugObject (string key);

		void DebugSegfault ();

		long Decr (string key);

		long DecrBy (string key, long value);

		int Del (params string[] keys);

		bool Discard ();

		string Echo (string msg);

		System.Collections.Generic.IEnumerable<T> Exec<T> ();

		bool Exists (string key);

		bool Expire (string key, TimeSpan span);

		bool ExpireAt (string key, DateTime time);

		bool FlushAll ();

		bool FlushDb ();

		byte[] Get (string key);

		int GetBit (string key, int offset);

		byte[] GetRange (string key, int start, int end);

		byte[] GetRangeRaw (string key, int start, int end);

		int GetRangeTo (string key, int start, int end, System.IO.Stream target);

		byte[] GetRaw (string key);

		byte[] GetSet (string key, byte[] value);

		int GetTo (string key, System.IO.Stream target);

		int HDel (string key, params string[] fields);

		bool HDel (string key, string field);

		bool HExists (string key, string field);

		byte[] HGet (string key, string field);

		System.Collections.Generic.KeyValuePair<string, byte[]>[] HGetAll (string key);

		byte[] HGetRaw (string key, string field);

		int HGetTo (string key, string field, System.IO.Stream target);

		long HIncrBy (string key, string field, long amount);

		string[] HKeys (string key);

		int HLen (string key);

		byte[][] HMGet (string key, params string[] fields);

		bool HMSet (string key, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, byte[]>> mappings);

		bool HSet (string key, string field, byte[] value);

		bool HSetFrom (string key, string field, System.IO.Stream source, int count);

		bool HSetNX (string key, string field, byte[] value);

		bool HSetRaw (string key, string field, byte[] data);

		byte[][] HVals (string key);

		long Incr (string key);

		long IncrBy (string key, long value);

		System.Collections.Generic.KeyValuePair<string, string>[] Info ();

		string[] Keys (string pattern);

		DateTime LastSave ();

		byte[] LIndex (string key, int index);

		int LInsert (string key, byte[] pivot, byte[] value, bool afterPivot = false);

		int LLen (string key);

		byte[] LPop (string key);

		int LPush (string key, params byte[][] values);

		int LPush (string key, byte[] value);

		int LPushX (string key, byte[] value);

		byte[][] LRange (string key, int minIncl, int maxIncl);

		int LRem (string key, int count, byte[] value);

		bool LSet (string key, int index, byte[] value);

		bool LTrim (string key, int minIncl, int maxIncl);

		byte[][] MGet (params string[] keys);

		IObservable<string> Monitor ();

		bool Move (string key, int dbIndex);

		bool Migrate (string host, int port, string key, int dbIndex, int timeout, bool copy, bool replace);

		bool MSet (System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, byte[]>> mappings);

		bool MSetNX (System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, byte[]>> mappings);

		bool Multi ();

		bool Persist (string key);

		bool Ping ();

		IObservable<Message> PSubscribe (params string[] keys);

		int Publish (string channel, byte[] msg);

		IObservable<Message> PUnsubscribe (params string[] keys);

		void Quit ();

		string RandomKey ();

		bool Rename (string oldKey, string newKey);

		bool RenameNX (string oldKey, string newKey);

		byte[] RPop (string key);

		byte[] RPopLPush (string srcKey, string destKey);

		int RPush (string key, params byte[][] values);

		int RPush (string key, byte[] value);

		int RPushX (string key, byte[] value);

		int SAdd (string key, params byte[][] values);

		bool SAdd (string key, byte[] value);

		bool Save ();

		int SCard (string key);

		byte[][] SDiff (params string[] keys);

		bool SDiffStore (string destKey, params string[] keys);

		bool Select (int dbIndex);

		bool Set (string key, byte[] value);

		int SetBit (string key, int offset, int value);

		bool SetEX (string key, TimeSpan ttl, byte[] value);

		bool SetFrom (string key, System.IO.Stream source, int count);

		bool SetNX (string key, byte[] value);

		int SetRange (string key, int offset, byte[] value);

		int SetRangeFrom (string key, int offset, System.IO.Stream source, int count);

		int SetRangeRaw (string key, int offset, byte[] value);

		bool SetRaw (string key, byte[] raw);

		void Shutdown ();

		byte[][] SInter (params string[] keys);

		bool SInterStore (string destKey, params string[] keys);

		bool SIsMember (string key, byte[] value);

		bool SlaveOf (string host, int port);

		byte[][] SMembers (string key);

		bool SMove (string srcKey, string destKey, byte[] value);

		byte[][] Sort (string key, string byPattern = null, int? limitOffset = null, int? limitCount = null, string[] getPattern = null, bool descending = false, bool alpha = false, string store = null);

		byte[] SPop (string key);

		byte[] SRandMember (string key);

		int SRem (string key, params byte[][] values);

		bool SRem (string key, byte[] value);

		int Strlen (string key);

		IObservable<Message> Subscribe (params string[] keys);

		byte[][] SUnion (params string[] keys);

		bool SUnionStore (string destKey, params string[] keys);

		TimeSpan TTL (string key);

		RedisType Type (string key);

		IObservable<Message> Unsubscribe (params string[] keys);

		bool Unwatch ();

		bool Watch (params string[] keys);

		int ZAdd (string key, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<double, byte[]>> values);

		bool ZAdd (string key, double score, byte[] value);

		int ZCard (string key);

		int ZCount (string key, double minIncl, double maxIncl);

		double ZIncrBy (string key, double amount, byte[] value);

		int ZInterStore (string destKey, params string[] srcKeys);

		int ZInterStore (string destKey, string[] srcKeys, int[] weights = null, Aggregate aggregate = Aggregate.None);

		byte[][] ZRange (string key, int startRank, int endRank);

		System.Collections.Generic.KeyValuePair<byte[], double>[] ZRange (string key, int startRank, int endRank, bool withScores);

		System.Collections.Generic.KeyValuePair<byte[], double>[] ZRangeByScore (string key, double minIncl, double maxIncl, bool withScores, int? limitOffset = null, int? limitCount = null);

		byte[][] ZRangeByScore (string key, double minIncl, double maxIncl, int? limitOffset = null, int? limitCount = null);

		int ZRank (string key, byte[] value);

		int ZRem (string key, params byte[][] values);

		bool ZRem (string key, byte[] value);

		int ZRemRangeByRank (string key, int startRank, int endRank);

		int ZRemRangeByScore (string key, double minIncl, double maxIncl);

		byte[][] ZRevRange (string key, int startRank, int endRank);

		System.Collections.Generic.KeyValuePair<byte[], double>[] ZRevRange (string key, int startRank, int endRank, bool withScores);

		System.Collections.Generic.KeyValuePair<byte[], double>[] ZRevRangeByScore (string key, double minIncl, double maxIncl, bool withScores, int? limitOffset = null, int? limitCount = null);

		byte[][] ZRevRangeByScore (string key, double minIncl, double maxIncl, int? limitOffset = null, int? limitCount = null);

		int ZRevRank (string key, byte[] value);

		double? ZScore (string key, byte[] value);

		int ZUnionStore (string destKey, params string[] srcKeys);

		int ZUnionStore (string destKey, string[] srcKeys, int[] weights = null, Aggregate aggregate = Aggregate.None);
	}
}
